import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get'
  })
}

export function getRoles(data) {
  return request({
    url: 'role/lists',
    method: 'post',
    data
  })
}

export function saveRole(data) {
  return request({
    url: 'role/save',
    method: 'post',
    data
  })
}

export function getMenus(id) {
  return request({
    url: 'menu/menuLists/' + id,
    method: 'get'
  })
}

export function saveRoleMenu(data) {
  return request({
    url: 'role/saveRoleAndMenus',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `/vue-element-admin/role/${id}`,
    method: 'put',
    data
  })
}

export function del(id) {
  return request({
    url: `role/del/${id}`,
    method: 'get'
  })
}
